package org.zoomdev.zoom.ioc.test.shop.modules;

import org.zoomdev.zoom.ioc.Ioc;
import org.zoomdev.zoom.ioc.annotations.Inject;
import org.zoomdev.zoom.ioc.annotations.IocBean;
import org.zoomdev.zoom.ioc.annotations.Module;
import org.zoomdev.zoom.ioc.annotations.ModuleInit;
import org.zoomdev.zoom.ioc.impl.factories.ModuleIocFactory;
import org.zoomdev.zoom.ioc.test.shop.services.Dao;
import org.zoomdev.zoom.ioc.test.shop.services.EmptyService;
import org.zoomdev.zoom.ioc.test.shop.services.IocUserService;

@Module
public class UserModule implements ModuleIocFactory.ModuleInitialize {

    @IocBean
    public IocUserService getUserService(Dao dao) {
        return new IocUserService(dao);
    }

    @Override
    public void initialize(Ioc ioc) {
        System.out.println("module init ");
    }


    @ModuleInit
    public void init(IocUserService iocUserService) {
        System.out.println("init service" + iocUserService);
    }


    @ModuleInit
    public void init1(IocUserService iocUserService,
                      @Inject(config = "name")
                      String name) {
        System.out.println("init service" + iocUserService);
    }

    @ModuleInit
    public void init2(IocUserService iocUserService,
                      @Inject(config = "count")
                      int count) {
        System.out.println("init service" + iocUserService);
    }

    @IocBean
    public void voidIocBean() {

    }


    @IocBean
    public EmptyService getEmpty() {
        return null;
    }
}
